<?php

namespace App\Http\Requests\Api;
class PasswordRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'old_password' => 'required|min:6|max:32',
            'password' => 'required|min:6|max:32|confirmed',
        ];
    }

    public function messages(): array
    {
        return [
            'old_password.required' => '旧密码不能为空',
            'old_password.min' => '旧密码最小长度为 6 个字符',
            'old_password.max' => '旧密码最大长度为 32 个字符',
            'password.required' => '新密码不能为空',
            'password.min' => '新密码最小长度为 6 个字符',
            'password.max' => '新密码最大长度为 32 个字符',
            'password.confirmed' => '两次密码输入不一致',
        ];
    }
}
